<?php

namespace api\models;

use Yii;

/**
 * This is the model class for table "pub_user".
 *
 * @property int $id
 * @property string $openid openid
 * @property string $nickname 用户昵称
 * @property string $headimgurl 头像
 * @property string $unionid 用户unionid
 * @property string $city 市
 * @property string $province 省
 * @property int $create_time 创建时间 
 * @property int $update_time 更新时间
 * @property int $sex 1男 2女 0未知
 */
class PubUser extends \yii\db\ActiveRecord
{
    /**
     * {@inheritdoc}
     */
    public static function tableName()
    {
        return 'pub_user';
    }

    /**
     * {@inheritdoc}
     */
    public function rules()
    {
        return [
            [['openid'], 'required'],
            [['headimgurl'], 'string'],
            [['create_time', 'update_time', 'sex'], 'integer'],
            [['openid', 'unionid'], 'string', 'max' => 60],
            [['nickname'], 'string', 'max' => 100],
            [['city', 'province'], 'string', 'max' => 20],
        ];
    }

    /**
     * {@inheritdoc}
     */
    public function attributeLabels()
    {
        return [
            'id' => 'ID',
            'openid' => 'Openid',
            'nickname' => 'Nickname',
            'headimgurl' => 'Headimgurl',
            'unionid' => 'Unionid',
            'city' => 'City',
            'province' => 'Province',
            'create_time' => 'Create Time',
            'update_time' => 'Update Time',
            'sex' => 'Sex',
        ];
    }
}
